﻿using HandyControl.Controls;

namespace WordCloudClient
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow
    {
        public MainWindow()
        {
            InitializeComponent();
        }
        //private void ModifyUI()
        //{
        //    //// 模拟一些工作正在进行
        //    //Thread.Sleep(TimeSpan.FromSeconds(2));
        //    //lblHello.Content = "欢迎你光临WPF的世界,Dispatcher";

        //    // 模拟一些工作正在进行

        //    this.Dispatcher.Invoke(DispatcherPriority.Normal, (ThreadStart)delegate ()
        //    {
        //        LoadingLineX.Visibility = Visibility.Visible;
        //    });
        //    Thread.Sleep(TimeSpan.FromSeconds(5));
        //    this.Dispatcher.Invoke(DispatcherPriority.Normal, (ThreadStart)delegate ()
        //    {
        //        LoadingLineX.Visibility = Visibility.Hidden;
        //        lblHello.Content = "欢迎你光临WPF的世界,Dispatche  同步方法 ！！";
        //    });
        //}

        //private void btnThd_Click(object sender, RoutedEventArgs e)
        //{
        //    Thread thread = new Thread(ModifyUI);
        //    thread.Start();
        //}

        //private void btnAppBeginInvoke_Click(object sender, RoutedEventArgs e)
        //{
        //    new Thread(() =>
        //    {
        //        Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
        //            new Action(() =>
        //            {
        //                LoadingLineX.Visibility = Visibility.Visible;
                        
        //            }));
        //    }).Start();
        //    new Thread(() =>
        //    {
        //        Thread.Sleep(TimeSpan.FromSeconds(5));
        //        Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
        //            new Action(() =>
        //            {
        //                LoadingLineX.Visibility = Visibility.Hidden;
        //                //Thread.Sleep(TimeSpan.FromSeconds(3)); // 放这里还是会卡 UI 界面线程
        //                this.lblHello.Content = "欢迎你光临WPF的世界,Dispatche 异步方法！！" + DateTime.Now.ToString();
        //            }));
        //    }).Start();
        //}
    }
}
